home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / TCL1 / CSCROLLL / CSCROLLL.C1 < prev    next >
Text File  |  1992-02-19  |  3KB  |  99 lines

  1. /*************************************************************************************
  2.  
  3.  CScrollList.c
  4.     
  5.         Standard scrolling list to allow dragging of elements to arrange in
  6.         any order.
  7.         
  8.         gHandCursor must be loaded ahead of time (at application startup).
  9.     
  10.     SUPERCLASS = CArrayPane
  11.     
  12.     REQUIRES:    CScrollListDragger
  13.                 CTextEnvirons
  14.     
  15.         by Dave Harkness
  16.  
  17. *************************************************************************************/
  18.  
  19.  
  20. #include "CScrollList.h"
  21. #include "CScrollListDragger.h"
  22. #include "CTextEnvirons.h"
  23.  
  24.  
  25. extern CursHandle    gHandCursor;
  26.  
  27. /******************************************************************************
  28.  IScrollList
  29. ******************************************************************************/
  30.  
  31. void CScrollList::IScrollList( CView *anEnclosure, CBureaucrat *aSupervisor,
  32.                         short aWidth, short aHeight,
  33.                         short aHEncl, short aVEncl,
  34.                         SizingOption aHSizing, SizingOption aVSizing)
  35. {
  36.     CArrayPane::IArrayPane( anEnclosure, aSupervisor, aWidth, aHeight,
  37.                     aHEncl, aVEncl, aHSizing, aVSizing);
  38.  
  39. }    /* CScrollList::IScrollList */
  40.  
  41.  
  42. /******************************************************************************
  43.  CreateTextEnvironment {OVERRIDE}
  44.  
  45.     Create and initialize the text environment used for drawing text.
  46.     it will also be used for calculating the default indent and row height.
  47. ******************************************************************************/
  48.  
  49. void CScrollList::CreateTextEnvironment( void)
  50. {
  51.     CTextEnvirons *textEnvirons;
  52.     TextInfoRec    textInfo;
  53.  
  54.     textEnvirons = new( CTextEnvirons);
  55.     itsEnvironment = textEnvirons;
  56.     textEnvirons->ITextEnvirons();
  57.     
  58.     textInfo.fontNumber = geneva;
  59.     textInfo.theSize = 9;
  60.     textInfo.theStyle = 0;
  61.     textInfo.theMode = srcOr;
  62.     
  63.     textEnvirons->SetTextInfo( &textInfo);
  64.  
  65. }    /* CScrollList::CreateTextEnvironment */
  66.  
  67.  
  68. /******************************************************************************
  69.  AdjustCursor {OVERRIDE}
  70.  
  71.     Adjust the cursor to the dragging hand.
  72. ******************************************************************************/
  73.  
  74. void CScrollList::AdjustCursor( Point where, RgnHandle mouseRgn)
  75. {
  76.     SetCursor( *gHandCursor);
  77.  
  78. }    /* CScrollList::AdjustCursor */
  79.  
  80.  
  81. /******************************************************************************
  82.  MakeMouseTask
  83.  
  84.     Make the dragging mouse task to allow items in the list to be moved.
  85. ******************************************************************************/
  86.  
  87. CMouseTask *CScrollList::MakeMouseTask( short modifiers)
  88. {
  89.     CScrollListDragger    *tblTask;
  90.     
  91.     if (!(selectionFlags & selOnlyOne))
  92.         return inherited::MakeMouseTask( modifiers);
  93.     
  94.     tblTask = new( CScrollListDragger);
  95.     tblTask->IScrollListDragger( this, modifiers, selectionFlags);
  96.     return tblTask;
  97.     
  98. }    /* CScrollList::MakeMouseTask */
  99.